package hibernate2;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.query.NativeQuery;

public class Hibernate {

	public static void main(String[] args) {
		SessionFactory sf = new Configuration().configure().buildSessionFactory();
		Session session = sf.openSession();

		Player player =  session.get(Player.class, 1);
		
		System.out.println(player.getUsername());
		NativeQuery query = session.createNativeQuery("select * from player");
		
		List list = query.getResultList();
		
		System.out.println("find records in"+list.size());
		session.close();

	}

}
